<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'user-form',
    'enableAjaxValidation'=>false,
)); ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'username'); ?>
        <?php echo $form->textField($model,'username',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'username'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'lastName'); ?>
        <?php echo $form->textField($model,'lastName',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'lastName'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'firstName'); ?>
        <?php echo $form->textField($model,'firstName',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'firstName'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'salutation'); ?>
        <?php echo $form->dropDownList($model,'salutation',User::model()->salutationOptions,array('empty'=>Yii::t('site','(Select)'))); ?>
        <?php echo $form->error($model,'salutation'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'password'); ?>
        <?php echo $form->passwordField($model,'password',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'password'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'password2'); ?>
        <?php echo $form->passwordField($model,'password2',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'password2'); ?>
    </div>

        <div class="row">
        <?php echo $form->labelEx($model,'email'); ?>
        <?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
        <?php echo $form->error($model,'email'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'birthDate'); ?>
        <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model'=>$model,
                'name'=>'User[birthDate]',
                'value'=>Yii::app()->lc->toLocal($model->birthDate, 'date', 'medium'),                
                'language'=>Yii::app()->lc->getSelectedLanguageCalendar(),
                'options' => array('dateFormat'=>Yii::app()->locale->getDateFormat('calendar_small'),'changeMonth'=>true,'changeYear'=>true,'showButtonPanel'=>true),
                'htmlOptions' => array(/*'readonly'=>"readonly",*/'size'=>10,'maxlength'=>10,'class'=>'centered')
            )); ?>
        <?php echo $form->error($model,'birthDate'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'profile'); ?>
        <?php echo $form->textArea($model,'profile',array('rows'=>6, 'cols'=>50)); ?>
        <?php echo $form->error($model,'profile'); ?>
    </div>

    <div class="row">
        <label><?php echo Yii::t('site','Auth Assignments'); ?></label>
        <div class="grid-view">
            <table class="items" style="width:0">
                <thead>
                    <tr>
                        <th><?php echo Yii::t('site', 'Auth Item'); ?></th>
                        <th><?php echo Yii::t('site','Type') ?></th>
                        <th><?php echo Yii::t('site','Delete'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($model->authAssignments as $authAssignment) : ?>
                    <tr>
                        <td>
                            <?php echo CHtml::encode($authAssignment->itemname); ?>
                        </td>
                        <td>
                            <?php echo AuthItem::model()->typeOptions[AuthItem::model()->findByAttributes(array('name'=>$authAssignment->itemname))->type]; ?>
                        </td>
                        <td>
                            <input type="checkbox" name="AuthAssignment[delete][]" value="<?php echo $authAssignment->itemname.'|'.$authAssignment->userid ?>" />
                        </td>
                    </tr>
                    <?php endforeach; ?>
                    <tr>
                        <td><?php echo CHtml::dropDownList('AuthAssignment[add]','',AuthItem::model()->selectOptions,array('empty'=>Yii::t('site','(Select)'))); ?></td>
                        <td></td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'registrationComplete'); ?>
        <?php echo $form->checkBox($model,'registrationComplete'); ?>
        <?php echo $form->error($model,'registrationComplete'); ?>
    </div>

    <div class="row buttons">
        <?php $this->widget( 'application.extensions.button.DDButton',
            array(
                'title'=>$model->isNewRecord ? Yii::t('site','Create') : Yii::t('site','Save'),
                'linkTitle'=>$model->isNewRecord ? Yii::t('site','Create this item') : Yii::t('site','Save this item'),
                'formID' => 'user-form',
                'buttonType' => 'save'
        )); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
            array(
                'title'=>Yii::t('site','Reset'),
                'linkTitle'=>Yii::t('site','Reset the form data'),
                'formID' => 'user-form',
                'buttonType' => 'reset',
                'confirm' => Yii::t('site','Really reset this form?')
        )); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
            array(
                'title'=>Yii::t('site','Cancel'),
                'linkTitle'=>Yii::t('site','Cancel editing, back to list'),
                'formID' => 'user-form',
                'buttonType' => 'cancel',
                'confirm' => Yii::t('site','Really cancel editing this item?'),
                'url' => array('admin')
        )); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
